home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
mochi_hungryplush.swf
/
scripts
/
frame_40
/
DoAction.as
Wrap
Text File
|
2011-10-17
|
3KB
|
93 lines
enemyFish._visible = false;
fishies = new Array();
fishMade = d = score = 0;
minimumFishOnScreen = 7;
maximumFishOnScreen = 15;
frame = _currentframe;
stop();
_root.onEnterFrame = function()
{
if(_currentframe == frame)
{
if(_root.fish._width < Stage.width)
{
fishFound = 0;
i = 0;
while(i < fishies.length)
{
if(fishies[i] == 1)
{
fishFound++;
}
i++;
}
if(fishFound < minimumFishOnScreen)
{
chanceOfNewFishComing = 0;
}
else if(fishFound < maximumFishOnScreen)
{
chanceOfNewFishComing = random(60);
}
if(chanceOfNewFishComing == 0)
{
enemyFish.duplicateMovieClip("newEnemyFish" + d,d++,{left:random(2),speed:random(6) + 2,scale:random(_root.fish.scale + 40) + 10,_y:random(Stage.height),newFish:true});
fishies[fishMade] = 1;
fishMade++;
}
i = 0;
while(i < fishies.length)
{
if(fishies[i] == 1)
{
_root["newEnemyFish" + i]._x += _root["newEnemyFish" + i].speed;
if(_root["newEnemyFish" + i].hitTest(_root.fish))
{
if(_root["newEnemyFish" + i].scale <= _root.fish.scale)
{
fish.scale += 5;
score += _root["newEnemyFish" + i].scale;
removeMovieClip(_root["newEnemyFish" + i]);
fishies[i] = 0;
}
else
{
nextFrame();
clearScreen();
}
}
if(_root["newEnemyFish" + i].left == 1)
{
if(_root["newEnemyFish" + i]._x < - _root["newEnemyFish" + i]._width)
{
fishies[i] = 0;
removeMovieClip(_root["newEnemyFish" + i]);
}
}
else if(_root["newEnemyFish" + i]._x > Stage.width + _root["newEnemyFish" + i]._width)
{
fishies[i] = 0;
removeMovieClip(_root["newEnemyFish" + i]);
}
}
i++;
}
}
else
{
_root.gotoAndStop(_currentframe + 2);
}
}
};
clearScreen = function()
{
i = 0;
while(i < fishies.length)
{
removeMovieClip(_root["newEnemyFish" + i]);
i++;
}
fishies = new Array();
fishMade = 0;
};